package com.tiancheng.trade.payment.controller.admin;

import com.tiancheng.trade.commom.core.data.PageInfo;
import com.tiancheng.trade.commom.core.data.Result;
import com.tiancheng.trade.payment.service.CouponSettleFileService;
import com.tiancheng.trade.payment.vo.admin.CouponSettleFileQueryVO;
import com.tiancheng.trade.payment.vo.admin.res.CouponSettleFileResVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Author: likailun
 * @Description: 优惠券清分汇总
 * @Date: create in 2021/12/28 11:39 上午
 */
@Slf4j
@RestController
@RequestMapping("/admin/couponSettleFile")
public class CouponSettleFileAdmin {

    @Resource
    private CouponSettleFileService settleFileService;

    /**
     * 分页查询优惠券清分汇总信息
     *
     * @param couponSettleFileQueryVO
     * @return
     */
    @GetMapping("/findPageList")
    public Result<PageInfo<CouponSettleFileResVo>> findList(CouponSettleFileQueryVO couponSettleFileQueryVO) {
        return Result.success(settleFileService.findList(couponSettleFileQueryVO));
    }


    /**
     * 导出优惠券清分汇总信息
     */
    @PostMapping("/exportList")
    public void exportList(@RequestBody CouponSettleFileQueryVO couponSettleFileQueryVO, HttpServletResponse response, HttpServletRequest request)
            throws IOException {
        settleFileService.exportList(couponSettleFileQueryVO, response, request);
    }

}
